package com.keyinong.parkin.home.adapter;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import com.example.parkin.R;
import com.keyinong.parkin.home.bean.AddressBean;
import com.keyinong.parkin.home.bean.ParkinBean;

import android.content.Context;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class SelectParkinAdapter extends BaseAdapter {
    Context context;
    ArrayList<ParkinBean> list;
    
	public SelectParkinAdapter(Context context, ArrayList<ParkinBean> list) {
		super();
		this.context = context;
		this.list = list;
	}

	@Override
	public int getCount() {
		
		return list.size();
	}

	@Override
	public Object getItem(int position) {
		
		return list.get(position);
	}

	@Override
	public long getItemId(int position) {
		
		return 0;
	}

	@Override
	public View getView(int position, View view, ViewGroup parent) {
		ViewHandle handle;
		if (view == null) {
			handle = new ViewHandle();
			view = LayoutInflater.from(context).inflate(
					R.layout.item_list_selectpark, null);
			handle.tv_selectPark=(TextView) view.findViewById(R.id.tv_selectPark);
			view.setTag(handle);
		}else{
			handle=(ViewHandle) view.getTag();
		}
		handle.tv_selectPark.setText(list.get(position).getParkname());
		
		return view;
	}

	private class ViewHandle {
		TextView tv_selectPark;
	}

}
